﻿using AiFrame.InterfaceLib.Windows.Controls;

namespace AiFrame.InterfaceLib.MVP
{
    /// <summary>
    /// Represents a container view for data windows.
    /// Through the navigation bar it allows other windows to register
    /// and to manipulate the data source.
    /// </summary>
    /// <typeparam name="T">Type of the data source.</typeparam>
    public interface IDataContainerView<T>: IErrorDisplayable
    {
        /// <summary>
        /// Shows the view.
        /// </summary>
        void ShowView();

        /// <summary>
        /// Returns the navigation bar.
        /// </summary>
        IDataNavigationBar NavigationBar { get; }

        /// <summary>
        /// Returns the data source provider..
        /// </summary>
        IDataSourceProvider<T> DataSourceProvider { get; }

        /// <summary>
        /// Returns if the data source has been changed.
        /// </summary>
        bool DataChanged { get; }

        /// <summary>
        /// Returns if the data source has been saved successfully.
        /// If it contains changes and has not been saved already
        /// a dialogue should be shown to ask the user to save.
        /// 
        /// Speichert er anschließend, wird TRUE zurückgegeben, ansonsten FALSE. 
        /// </summary>
        /// <returns>True, if data has not been changed or if the user saves the changes. False, otherwise.</returns>
        bool DataObjectSavedQuery();
    }
}
